#pragma once
#ifndef Connection_h__
#define Connection_h__

#include <QSslSocket>

namespace TC
{
    class Connection : public QSslSocket
    {
        Q_OBJECT;
    public:
        Connection(QObject *parent = nullptr);
    public:
        void connectToHostEncrypted(const QString &hostName, quint16 port, OpenMode mode = ReadWrite, NetworkLayerProtocol protocol = AnyIPProtocol);
    protected:
        void onConnectTimeout();
        void onSocketError(QAbstractSocket::SocketError socketError);
    signals:
        void error(const QString &reason);
    };
}

#endif // Connection_h__
